package edu.hitwh.record;

import edu.hitwh.entity.Borrower;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@Builder
@NoArgsConstructor
public class BorrowerRecord {
    private Long id;
    private String name;
    private String password;
    private String email;

    public static BorrowerRecord fromEntity(Borrower borrower) {
        return BorrowerRecord.builder()
                .id(borrower.getId())
                .name(borrower.getName())
                .password(borrower.getPassword())
                .email(borrower.getEmail())
                .build();
    }

    public Borrower toEntity() {
        return Borrower.builder()
                .id(this.id)
                .name(this.name)
                .password(this.password)
                .email(this.email)
                .build();
    }
}